As information network systems continue to proliferate, network processing applications and hardware for processing packets quickly and efficiently are increasingly important. Network switches and/or routers receive packets, extract information from the packet header/footers, and process the packets according to the extracted information. Network header information can establish, to name just a few possible examples, the destination of a packet and/or the manner in which a packet should be transmitted.
Packet routing and/or switching typically utilizes a matching function. In a matching function, a header field (or other packet field) is compared against a number of stored rules. In the event the field (or a portion of the field) matches a stored rule, a match indication is generated. The match indication can be used to take appropriate action on the packet.
One device that is particularly suitable for implementing matching functions is a content addressable memory (“CAM”), also referred to as an “associative memory.” FIG. 1 illustrates a conventional CAM array 100. CAM array 100 includes a key register 105 to store a key entry, a plurality of CAM cells 110 each to store a CAM entry W0-WN (also referred to as rule entries), and a priority encoder 115. CAM cells 110 are addressed according to the contents (i.e., CAM entries W0-WN) that they store. In a typical CAM matching function, a key (which can be a header field or a portion thereof) is loaded into key register 105 as the key entry. The key entry is then compared to each of the CAM entries W0-WN stored within CAM cells 110. In the event the key entry matches one of the CAM entries, a match signal for the matching CAM cell 110 is generated. In the event there is more than one match, the highest priority match(es) may be selected according to predetermined priority criteria implemented by priority encoder 115. Priority encoder 115 then outputs a match address identifying which CAM entry was a “hit” or match with the key entry.
CAM array 100 typically comes in two flavors a “binary” CAM array and a “ternary” CAM (“TCAM”) array. In a binary CAM array, the multi-bit key entry must exactly match every bit of a CAM entry to generate a hit. In a TCAM array, the multi-bit key entry can be compared with “maskable” bits of the CAM entries. Therefore, only the non-masked bits of the CAM entries must exactly match to generate a hit. Therefore, a masked bit of a CAM entry will not generate a mismatch indication even if the masked bit value is different than the corresponding bit value of the key entry.
Cam array 100 is well suited for use with network search engines, access control lists (“ACLs”), and other high density, high speed matching functions. One type of match function is a match against range rule (“MARR”). With MARR multiple CAM entries are stored to represent a single range rule (e.g., a<47). If the key entry happens to fall within a range stored with CAM cells 110, one or more of CAM cells 110 will generate a hit. Implementing a greater than X or less than X range rule within a convention CAM array, such as CAM array 100, requires up to 2*W−1 entries, where W is the number of bits in the binary representation of the range. For example, the range a<47 (or a<101111 in binary) would require six CAM entries, one for each bit of the binary representation, and therefore consume six rows of CAM cells 110 of CAM array 100. When implementing MARR with a large number of rules or with large ranges, the number of CAM cells 110 can be extremely large. The more CAM cells 110 needed, the larger the semiconductor real estate occupied and the greater the power consumed.